<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<body>
    <button onclick="onButtonClick();">取数据</button>
<script>
    function onButtonClick(){
         let username = sessionStorage.getItem("username");
         alert(username);
    }
</script>
</body>
</html>